@(recentRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo],
  userRepositories: List[gitbucket.core.service.RepositoryService.RepositoryInfo])(body: Html)(implicit context: gitbucket.core.controller.Context)
@import gitbucket.core.view.helpers
<div class="main-sidebar">
  <div class="sidebar">
  <ul class="nav sidebar-menu">
  @if(context.loginAccount.isDefined){
    <li class="header">
      <span class="label label-primary pull-right">@userRepositories.size</span>
      Your repositories
    </li>
    @if(userRepositories.isEmpty){
      <li>No repositories</li>
    } else {
      @defining(10){ max =>
        @userRepositories.zipWithIndex.map { case (repository, i) =>
        <li class="repo-link" style="@if(i > max - 1){display:none;}">
          @if(repository.owner == context.loginAccount.get.userName){
            <a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) <span class="strong">@repository.name</span></a>
          } else {
            <a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) @repository.owner/<span class="strong">@repository.name</span></a>
          }
          </li>
        }
        @if(userRepositories.size > max){
          <li class="show-more">
            <a href="javascript:void(0);" id="show-more-repos">Show @{userRepositories.size - max} more repositories...</a>
          </li>
        }
      }
    }
  } else {
    <li class="header">Recent updated repositories</li>
    @if(recentRepositories.isEmpty){
      <li>No repositories</li>
    } else {
      @defining(10){ max =>
        @recentRepositories.zipWithIndex.map { case (repository, i) =>
          <li class="repo-link" style="@if(i > max - 1){display:none;}">
            <a href="@helpers.url(repository)">@gitbucket.core.helper.html.repositoryicon(repository, false) @repository.owner/<span class="strong">@repository.name</span></a>
          </li>
        }
        @if(recentRepositories.size > max){
          <li class="show-more">
            <a href="javascript:void(0);" id="show-more-recent-repos">Show @{recentRepositories.size - max} more repositories...</a>
          </li>
        }
      }
    }
  }
  </ul>
  </div>
</div>
<div class="content-wrapper">
  <div class="content body">
    @body
  </div>
</div>
<script>
$(function(){
  $('#show-more-repos, #show-more-recent-repos').click(function(e){
    $(e.target).parents('ul').find('li.repo-link').show();
    $(e.target).parents('li.show-more').remove();
  });
});
</script>
